#include "HeatControl.h"
#include "DiscreteIntegrator.h"
#include "Constant.h"
#include "Sum.h"
#include "Gain.h"
#include "Sum2.h"
#include "Saturation.h"
#include "DiscreteDerivative.h"
#include "SchmittTrigger.h"
#include "Compare.h"
#include "DataTypeConversion.h"
#include "Switch.h"
#include "Inverter.h"

#ifdef HEATCONTROL_DISCRETEINTEGRATOR_INSTANCE_DECLS
HEATCONTROL_DISCRETEINTEGRATOR_INSTANCE_DECLS
#endif /* HEATCONTROL_DISCRETEINTEGRATOR_INSTANCE_DECLS */
#ifdef HEATCONTROL_CONSTANT_INSTANCE_DECLS
HEATCONTROL_CONSTANT_INSTANCE_DECLS
#endif /* HEATCONTROL_CONSTANT_INSTANCE_DECLS */
#ifdef HEATCONTROL_SUM_INSTANCE_DECLS
HEATCONTROL_SUM_INSTANCE_DECLS
#endif /* HEATCONTROL_SUM_INSTANCE_DECLS */
#ifdef HEATCONTROL_GAIN_INSTANCE_DECLS
HEATCONTROL_GAIN_INSTANCE_DECLS
#endif /* HEATCONTROL_GAIN_INSTANCE_DECLS */
#ifdef HEATCONTROL_SUM2_INSTANCE_DECLS
HEATCONTROL_SUM2_INSTANCE_DECLS
#endif /* HEATCONTROL_SUM2_INSTANCE_DECLS */
#ifdef HEATCONTROL_SATURATION_INSTANCE_DECLS
HEATCONTROL_SATURATION_INSTANCE_DECLS
#endif /* HEATCONTROL_SATURATION_INSTANCE_DECLS */
#ifdef HEATCONTROL_DISCRETEDERIVATIVE_INSTANCE_DECLS
HEATCONTROL_DISCRETEDERIVATIVE_INSTANCE_DECLS
#endif /* HEATCONTROL_DISCRETEDERIVATIVE_INSTANCE_DECLS */
#ifdef HEATCONTROL_SCHMITTTRIGGER_INSTANCE_DECLS
HEATCONTROL_SCHMITTTRIGGER_INSTANCE_DECLS
#endif /* HEATCONTROL_SCHMITTTRIGGER_INSTANCE_DECLS */
#ifdef HEATCONTROL_COMPARE_INSTANCE_DECLS
HEATCONTROL_COMPARE_INSTANCE_DECLS
#endif /* HEATCONTROL_COMPARE_INSTANCE_DECLS */
#ifdef HEATCONTROL_DATATYPECONVERSION_INSTANCE_DECLS
HEATCONTROL_DATATYPECONVERSION_INSTANCE_DECLS
#endif /* HEATCONTROL_DATATYPECONVERSION_INSTANCE_DECLS */
#ifdef HEATCONTROL_SWITCH_INSTANCE_DECLS
HEATCONTROL_SWITCH_INSTANCE_DECLS
#endif /* HEATCONTROL_SWITCH_INSTANCE_DECLS */
#ifdef HEATCONTROL_INVERTER_INSTANCE_DECLS
HEATCONTROL_INVERTER_INSTANCE_DECLS
#endif /* HEATCONTROL_INVERTER_INSTANCE_DECLS */

void HeatControl_initialize(void) {
	HeatControl_DiscreteIntegrator_initialize();
	HeatControl_Constant_initialize();
	HeatControl_Sum_initialize();
	HeatControl_Gain_initialize();
	HeatControl_Sum2_initialize();
	HeatControl_Saturation_initialize();
	HeatControl_DiscreteDerivative_initialize();
	HeatControl_SchmittTrigger_initialize();
	HeatControl_Compare_initialize();
	HeatControl_DataTypeConversion_initialize();
	HeatControl_Switch_initialize();
	HeatControl_Inverter_initialize();

}

void HeatControl_execute(const HeatControl_Input *input, HeatControl_Output *output) {
#ifdef HEATCONTROL_DISCRETEINTEGRATOR_LOCAL_DECLS
	HEATCONTROL_DISCRETEINTEGRATOR_LOCAL_DECLS
#endif /* HEATCONTROL_DISCRETEINTEGRATOR_LOCAL_DECLS */
#ifdef HEATCONTROL_CONSTANT_LOCAL_DECLS
	HEATCONTROL_CONSTANT_LOCAL_DECLS
#endif /* HEATCONTROL_CONSTANT_LOCAL_DECLS */
#ifdef HEATCONTROL_SUM_LOCAL_DECLS
	HEATCONTROL_SUM_LOCAL_DECLS
#endif /* HEATCONTROL_SUM_LOCAL_DECLS */
#ifdef HEATCONTROL_GAIN_LOCAL_DECLS
	HEATCONTROL_GAIN_LOCAL_DECLS
#endif /* HEATCONTROL_GAIN_LOCAL_DECLS */
#ifdef HEATCONTROL_SUM2_LOCAL_DECLS
	HEATCONTROL_SUM2_LOCAL_DECLS
#endif /* HEATCONTROL_SUM2_LOCAL_DECLS */
#ifdef HEATCONTROL_SATURATION_LOCAL_DECLS
	HEATCONTROL_SATURATION_LOCAL_DECLS
#endif /* HEATCONTROL_SATURATION_LOCAL_DECLS */
#ifdef HEATCONTROL_DISCRETEDERIVATIVE_LOCAL_DECLS
	HEATCONTROL_DISCRETEDERIVATIVE_LOCAL_DECLS
#endif /* HEATCONTROL_DISCRETEDERIVATIVE_LOCAL_DECLS */
#ifdef HEATCONTROL_SCHMITTTRIGGER_LOCAL_DECLS
	HEATCONTROL_SCHMITTTRIGGER_LOCAL_DECLS
#endif /* HEATCONTROL_SCHMITTTRIGGER_LOCAL_DECLS */
#ifdef HEATCONTROL_COMPARE_LOCAL_DECLS
	HEATCONTROL_COMPARE_LOCAL_DECLS
#endif /* HEATCONTROL_COMPARE_LOCAL_DECLS */
#ifdef HEATCONTROL_DATATYPECONVERSION_LOCAL_DECLS
	HEATCONTROL_DATATYPECONVERSION_LOCAL_DECLS
#endif /* HEATCONTROL_DATATYPECONVERSION_LOCAL_DECLS */
#ifdef HEATCONTROL_SWITCH_LOCAL_DECLS
	HEATCONTROL_SWITCH_LOCAL_DECLS
#endif /* HEATCONTROL_SWITCH_LOCAL_DECLS */
#ifdef HEATCONTROL_INVERTER_LOCAL_DECLS
	HEATCONTROL_INVERTER_LOCAL_DECLS
#endif /* HEATCONTROL_INVERTER_LOCAL_DECLS */

#ifdef HEATCONTROL_DISCRETEINTEGRATOR_LOCAL_INITS
	HEATCONTROL_DISCRETEINTEGRATOR_LOCAL_INITS
#endif /* HEATCONTROL_DISCRETEINTEGRATOR_LOCAL_INITS */
#ifdef HEATCONTROL_CONSTANT_LOCAL_INITS
	HEATCONTROL_CONSTANT_LOCAL_INITS
#endif /* HEATCONTROL_CONSTANT_LOCAL_INITS */
#ifdef HEATCONTROL_SUM_LOCAL_INITS
	HEATCONTROL_SUM_LOCAL_INITS
#endif /* HEATCONTROL_SUM_LOCAL_INITS */
#ifdef HEATCONTROL_GAIN_LOCAL_INITS
	HEATCONTROL_GAIN_LOCAL_INITS
#endif /* HEATCONTROL_GAIN_LOCAL_INITS */
#ifdef HEATCONTROL_SUM2_LOCAL_INITS
	HEATCONTROL_SUM2_LOCAL_INITS
#endif /* HEATCONTROL_SUM2_LOCAL_INITS */
#ifdef HEATCONTROL_SATURATION_LOCAL_INITS
	HEATCONTROL_SATURATION_LOCAL_INITS
#endif /* HEATCONTROL_SATURATION_LOCAL_INITS */
#ifdef HEATCONTROL_DISCRETEDERIVATIVE_LOCAL_INITS
	HEATCONTROL_DISCRETEDERIVATIVE_LOCAL_INITS
#endif /* HEATCONTROL_DISCRETEDERIVATIVE_LOCAL_INITS */
#ifdef HEATCONTROL_SCHMITTTRIGGER_LOCAL_INITS
	HEATCONTROL_SCHMITTTRIGGER_LOCAL_INITS
#endif /* HEATCONTROL_SCHMITTTRIGGER_LOCAL_INITS */
#ifdef HEATCONTROL_COMPARE_LOCAL_INITS
	HEATCONTROL_COMPARE_LOCAL_INITS
#endif /* HEATCONTROL_COMPARE_LOCAL_INITS */
#ifdef HEATCONTROL_DATATYPECONVERSION_LOCAL_INITS
	HEATCONTROL_DATATYPECONVERSION_LOCAL_INITS
#endif /* HEATCONTROL_DATATYPECONVERSION_LOCAL_INITS */
#ifdef HEATCONTROL_SWITCH_LOCAL_INITS
	HEATCONTROL_SWITCH_LOCAL_INITS
#endif /* HEATCONTROL_SWITCH_LOCAL_INITS */
#ifdef HEATCONTROL_INVERTER_LOCAL_INITS
	HEATCONTROL_INVERTER_LOCAL_INITS
#endif /* HEATCONTROL_INVERTER_LOCAL_INITS */

	{
		int32_t value;
		HeatControl_DiscreteIntegrator_computeOutputValues();
		value = HeatControl_DiscreteIntegrator_Output_getOutputValue();
		HeatControl_Sum2_Input_1_consumeInputValue(value);
	}

	HeatControl_Sum_Input_0_consumeInputValue(input->desiredTemperature);

	{
		int32_t value;
		HeatControl_Constant_computeOutputValues();
		value = HeatControl_Constant_Output_getOutputValue();
		HeatControl_Switch_OnFalse_consumeInputValue(value);
	}

	HeatControl_Sum_Input_1_consumeInputValue(input->actualTemperature);
	HeatControl_DiscreteDerivative_Input_consumeInputValue(input->actualTemperature);

	{
		int32_t value;
		HeatControl_Sum_computeOutputValues();
		value = HeatControl_Sum_Output_getOutputValue();
		HeatControl_Gain_Input_consumeInputValue(value);
		HeatControl_Switch_OnTrue_consumeInputValue(value);
	}

	{
		int32_t value;
		HeatControl_Gain_computeOutputValues();
		value = HeatControl_Gain_Output_getOutputValue();
		HeatControl_Sum2_Input_0_consumeInputValue(value);
	}

	{
		int32_t value;
		HeatControl_Sum2_computeOutputValues();
		value = HeatControl_Sum2_Output_getOutputValue();
		HeatControl_Saturation_Input_consumeInputValue(value);
		HeatControl_Compare_InputA_consumeInputValue(value);
	}

	{
		int32_t value;
		HeatControl_Saturation_computeOutputValues();
		value = HeatControl_Saturation_Output_getOutputValue();
		HeatControl_Compare_InputB_consumeInputValue(value);
		HeatControl_DataTypeConversion_Input_consumeInputValue(value);
	}

	{
		int32_t value;
		HeatControl_DiscreteDerivative_computeOutputValues();
		value = HeatControl_DiscreteDerivative_Output_getOutputValue();
		HeatControl_SchmittTrigger_Input_consumeInputValue(value);
	}

	{
		int value;
		HeatControl_SchmittTrigger_computeOutputValues();
		value = HeatControl_SchmittTrigger_Output_getOutputValue();
		HeatControl_Inverter_Input_consumeInputValue(value);
	}

	{
		int value;
		HeatControl_Compare_computeOutputValues();
		value = HeatControl_Compare_Output_getOutputValue();
		HeatControl_Switch_Control_consumeInputValue(value);
	}

	{
		int32_t value;
		HeatControl_DataTypeConversion_computeOutputValues();
		value = HeatControl_DataTypeConversion_Output_getOutputValue();
		output->power = value;
	}

	{
		int32_t value;
		HeatControl_Switch_computeOutputValues();
		value = HeatControl_Switch_Output_getOutputValue();
		HeatControl_DiscreteIntegrator_Input_consumeInputValue(value);
	}

	{
		int value;
		HeatControl_Inverter_computeOutputValues();
		value = HeatControl_Inverter_Output_getOutputValue();
		output->temperatureDrop = value;
	}

	HeatControl_DiscreteIntegrator_update();
	HeatControl_Constant_update();
	HeatControl_Sum_update();
	HeatControl_Gain_update();
	HeatControl_Sum2_update();
	HeatControl_Saturation_update();
	HeatControl_DiscreteDerivative_update();
	HeatControl_SchmittTrigger_update();
	HeatControl_Compare_update();
	HeatControl_DataTypeConversion_update();
	HeatControl_Switch_update();
	HeatControl_Inverter_update();

}
